package com.advertising.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.advertising.permissions.model.Users;

/**
 * 广告信息表
 * 
 */
@Entity
@Table(name = "adver_advertisement")
public class Release implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer aid;
	private String title; 
	private String introduction;//简介
	private String photo;//相处路径
	private String advertype;
	private String needcomment;
	private Integer commentstart;
	private Integer commentend;
	private Integer needanalysisreport;
	private String adverstate;
	private Integer price;//介格
	private String releasepattern;
	private Double longitude;// 经度
	private Double latitude; // 纬度
    private Double radius;//半径
	private Date startDate; // 开始时间
	private Date endDate;//结束时间

	private Integer releasetime;// 发布的次数
	
	private String account;//回退理由

	private Users user;
	//单击金额对像
	private Approve approve;

	/** default constructor */
	public Release() {
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "aid", unique = true, nullable = false)
	public Integer getAid() {
		return aid;
	}

	@Column(name = "title", length = 30)
	public String getTitle() {
		return title;
	}

	
	 

	@Column(name = "photo", length = 50)
	public String getPhoto() {
		return photo;
	}
	@Column(name = "introduction", length = 50)
	/**
	 * 简介
	 * @return
	 */
	public String getIntroduction() {
		return introduction;
	}

	@Column(name = "advertype", length = 11)
	public String getAdvertype() {
		return advertype;
	}

	@Column(name = "needcomment", length = 50)
	public String getNeedcomment() {
		return needcomment;
	}

	@Column(name = "commentstart", length = 50)
	public Integer getCommentstart() {
		return commentstart;
	}

	@Column(name = "commentend", length = 50)
	public Integer getCommentend() {
		return commentend;
	}

	@Column(name = "needanalysisreport", length = 50)
	public Integer getNeedanalysisreport() {
		return needanalysisreport;
	}

	@Column(name = "adverstate", length = 50)
	public String getAdverstate() {
		return adverstate;
	}

	@Column(name = "price", length = 50)
	public Integer getPrice() {
		return price;
	}

	@Column(name = "releasepattern", length = 50)
	public String getReleasepattern() {
		return releasepattern;
	}

	@Column(name = "latitude", length = 30)
	public Double getLatitude() {
		return latitude;
	}

	@Column(name = "longitude", length = 30)
	public Double getLongitude() {
		return longitude;
	}

	@Column(name = "start_date", length = 30)
	public Date getStartDate() {
		return startDate;
	}
	@Column(name = "end_date", length = 30)
	public Date getEndDate() {
		return endDate;
	}

	@Column(name = "releasetime", length = 30)
	public Integer getReleasetime() {
		return releasetime;
	}
	/**
	 * 半径
	 * @return
	 */
	@Column(name = "radius", length = 30)
	public Double getRadius() {
		return radius;
	}
	/**
	 * 回退理由
	 * @return
	 */
	@Column(name = "account", length = 200)
	public String getAccount() {
		return account;
	}
	
	public void setAid(Integer aid) {
		this.aid = aid;
	}

	public void setTitle(String title) {
		this.title = title;
	}

  

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	public void setAdvertype(String advertype) {
		this.advertype = advertype;
	}

	public void setNeedcomment(String needcomment) {
		this.needcomment = needcomment;
	}

	public void setCommentstart(Integer commentstart) {
		this.commentstart = commentstart;
	}

	public void setCommentend(Integer commentend) {
		this.commentend = commentend;
	}

	public void setNeedanalysisreport(Integer needanalysisreport) {
		this.needanalysisreport = needanalysisreport;
	}

	public void setAdverstate(String adverstate) {
		this.adverstate = adverstate;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id")
	public Users getUser() {
		return user;
	}
	//@ManyToOne(cascade=CascadeType.ALL,optional=false)
	@ManyToOne(fetch = FetchType.EAGER,cascade=CascadeType.ALL)

    // @JoinColumn(name = "approve_id", referencedColumnName = "id", nullable = true, insertable = false, updatable = false)
	@JoinColumn(name = "approve_id")
	public Approve getApprove() {
		return approve;
	}

	public void setApprove(Approve approve) {
		this.approve = approve;
	}

	public void setReleasepattern(String releasepattern) {
		this.releasepattern = releasepattern;
	}

	public void setUser(Users user) {
		this.user = user;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

 

	public void setReleasetime(Integer releasetime) {
		this.releasetime = releasetime;
	}

	
	
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	/**
	 * 半径
	 * @param radius
	 */
	public void setRadius(Double radius) {
		this.radius = radius;
	}

	/**
	 * 回退理由
	 * @param account
	 */
	public void setAccount(String account) {
		this.account = account;
	}
	
	
}
